package br.com.async.application.impl;

import java.util.List;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import br.com.async.application.RoomApplication;
import br.com.async.domain.room.Room;
import br.com.async.domain.room.RoomRepository;
import br.com.async.domain.room.RoomStatus;
import br.com.async.util.ResponseData;
@Transactional (propagation = Propagation.REQUIRED)
public class RoomApplicationImpl implements RoomApplication {

	private RoomRepository roomRepository;

	public RoomApplicationImpl(RoomRepository roomRepository) {
		super();
		this.roomRepository = roomRepository;
	}

	@Override
	public void persist(Room entity) {
		roomRepository.persist(entity);
	}

	@Override
	public void update(Room entity) {
		roomRepository.update(entity);
	}

	@Override
	public List<Room> list() {
		return roomRepository.list();
	}

	@Override
	public void disable(Room entity) {
		roomRepository.disable(entity);
	}

	@Override
	public Room findByCode(Integer code) {
		return roomRepository.findByCode(code);
	}

	@Override
	public ResponseData<Room> listRoomByCriterions(String name,
			RoomStatus roomStatus, String categoryCode, Integer offset,
			Integer maxResult) {
		
		return roomRepository.listRoomByCriterions(name, roomStatus, categoryCode, offset, maxResult);
	}

}
